home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Libris Britannia 4
/
science library(b).zip
/
science library(b)
/
PROGRAMM
/
DB_CLIPP
/
0411.ZIP
/
NDATE.C
< prev
next >
Wrap
Text File
|
1985-04-08
|
963b
|
40 lines
/*
* The purpose of this procedure is to return into a string 10
* characters long the date in the format dd-mmm-yy.
* dd is a 2 digit decimal figure,
* mmm is a 3 character string, with the initial character capitalised,
* yy is a 2 digit decimal figure.
*/
ndate()
{
int dmm,
ddd,
dyy,
cntr,
charcnt;
char date[9],
month[4],
temp,
s[10];
dates(date);
sscanf(date,"%2d %c %2d %c %2d",&dmm,&temp,&ddd,&temp,&dyy);
charcnt=((dmm-1)*3);
strncpy(&month,"JanFebMarAprMayJunJulAugSepOctNovDec"+charcnt,3);
month[3]='\0';
sprintf(s,"%2d-%3s-%2d",ddd,month,dyy);
s[9]='\0';
if (*s==' ')
{
*s='0';
}
printf("Ndate version = %s.\n",s);
cntr=0;
while (cntr<=9)
{
temp=*(s+cntr);
printf("Char %d = %c.\n",cntr,temp);
++cntr;
}
return(&s);
}